<template>
  <div>
    <el-drawer
      title="列显隐"
      :visible.sync="drawer"
      :modal-append-to-body="false"
      :append-to-body="true"
      :close-on-click-modal="false"
      :direction="direction"
      size="40%"
      :before-close="handleClose">
      <el-transfer v-model="transferList" class="beetles-transfer" :data="data"
                   :titles="['隐藏', '显示']" filterable></el-transfer>
    </el-drawer>
  </div>
</template>

<script>
export default {
  name: "beetles-table-transfer",
  props: ['drawer', 'data', 'hideList'],
  data() {
    return {
      direction: 'rtl',
      transferList: [],
      showData :[],
    }
  },
  watch: {
    hideList: {
      deep: true,
      handler(val) {
        this.transferList = val
      }
    }
  },
  methods: {
    /**
     * 关闭抽屉
     */
    handleClose() {
      this.$emit('close-drawer',this.transferList)
    },
  }
}
</script>

<style scoped lang="scss">
.beetles-transfer {
  position: relative;
  padding: 0 20px;
  height: 80%;

  /deep/ .el-transfer-panel__body {
    height: 100%;

  }

  /deep/ .el-transfer-panel__list {
    height: 100% !important;
  }

  /deep/ .el-transfer__buttons {
    display: flex;
    justify-content: center;
    flex-direction: column;

    :nth-child(2) {
      margin: 0 !important;
    }
  }

  /deep/ .el-transfer-panel {
    max-height: 100%;
    width: 40%;
    min-width: 200px;
  }
}
</style>
